]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
userMenu: Hide "Log out" item on single user machines
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 10 May 2012 11:16:15 +0000 (13:16 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 10 May 2012 13:54:37 +0000 (15:54 +0200)
Ignoring remote logins, the "Log out" action is meaningless for
single user setups. Do not show it in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=675802

js/ui/userMenu.js

index 93f4dc337ad8f7c47dba790183bd0052b922cfce..5b46ca801bdec5a72ffa528bf952a9249e520770 100644 (file)
@@ -497,13 +497,13 @@ const UserMenuButton = new Lang.Class({
         }));
 
         this._userManager.connect('notify::is-loaded',
-                                  Lang.bind(this, this._updateSwitchUser));
+                                  Lang.bind(this, this._updateMultiUser));
         this._userManager.connect('notify::has-multiple-users',
-                                  Lang.bind(this, this._updateSwitchUser));
+                                  Lang.bind(this, this._updateMultiUser));
         this._userManager.connect('user-added',
-                                  Lang.bind(this, this._updateSwitchUser));
+                                  Lang.bind(this, this._updateMultiUser));
         this._userManager.connect('user-removed',
-                                  Lang.bind(this, this._updateSwitchUser));
+                                  Lang.bind(this, this._updateMultiUser));
         this._lockdownSettings.connect('changed::' + DISABLE_USER_SWITCH_KEY,
                                        Lang.bind(this, this._updateSwitchUser));
         this._lockdownSettings.connect('changed::' + DISABLE_LOG_OUT_KEY,
@@ -542,6 +542,11 @@ const UserMenuButton = new Lang.Class({
             this._name.set_text("");
     },
 
+    _updateMultiUser: function() {
+        this._updateSwitchUser();
+        this._updateLogout();
+    },
+
     _updateSwitchUser: function() {
         let allowSwitch = !this._lockdownSettings.get_boolean(DISABLE_USER_SWITCH_KEY);
         this._loginScreenItem.actor.visible = allowSwitch &&
@@ -551,7 +556,7 @@ const UserMenuButton = new Lang.Class({
 
     _updateLogout: function() {
         let allowLogout = !this._lockdownSettings.get_boolean(DISABLE_LOG_OUT_KEY);
-        this._logoutItem.actor.visible = allowLogout;
+        this._logoutItem.actor.visible = allowLogout && this._userManager.has_multiple_users;
     },
 
     _updateLockScreen: function() {